﻿<!--********************* Part1:Jsp Head *********************-->
<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>
<!--********************* Part2:Java Code *********************-->
<%
	WarehouseCategorySearchEvent event = (WarehouseCategorySearchEvent)context.getSessionValue("WarehouseCategorySearchEvent");
	ObjectList list = WarehouseCategory.fetch().search(con,event);  
%>
<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->
<script language=javascript>

var list_code = "listWarehouseCategory";

function doSearch()
{
	SetValue("s_WarehouseCode",GetValue("i_WarehouseCode")); //仓库编码
	SetValue("s_CategoryName",GetValue("i_CategoryName")); //分类名称
	SetValue("s_Status",GetValue("i_Status")); //是否有效
	SetValue("s_OrderField",GetValue("i_OrderField")); //排序
	SetValue("s_OrderDesc",getCheckBoxValues("i_OrderDesc")); //升降序
	doCommonSearch();
}

function bizViewWarehouseCategory(id)
{
	viewWin("<%=Config.getSrv()%>?action_code=viewWarehouseCategory&Id="+id);
}

function doDelete()
{
	if(!hasChooseRadio("ids"))
	{
		bizMessage("删除","仓库分类表");
		return false;
	}
	if(!bizConfirm("删除","仓库分类表")) return false;
	SetAction("deleteWarehouseCategory");
	frm.submit();
}

function doToAdd()
{
	SetAction("toAddWarehouseCategory");
	frm.submit();
}

function doToUpdate()
{
	if(!checkOne("ids")) 
	{
		bizMessage("修改","仓库分类表");
		return false;
	}
	SetValue("Id",getCheckBoxValue("ids"));
	SetAction("toUpdateWarehouseCategory");
	frm.submit();
}

function doToAddSub()
{
	if(!checkOne("ids")) 
	{
		bizMessage("添加子类","仓库分类表");
		return false;
	}
	SetValue("Id",getCheckBoxValue("ids"));
	SetAction("toCopyWarehouseCategory");
	frm.submit();
}
function notSetCategory()
{
    SetAction("toCopyWarehouseCategory");
    if(GetValue("i_WarehouseCode")==''){
        bizMessage("选择","仓库");
        return false;
    }else{
      SetValue("s_WarehouseCode",GetValue("i_WarehouseCode")); //仓库编码
    }
    
    frm.submit();
}

function doProduct()
{
    if(!checkOne("ids")) 
    {
        bizMessage("产品管理","产品表");
        return false;
    }
    SetValue("warehouseCategoryId",getCheckBoxValue("ids"));
    SetAction("toProductManage");
    frm.submit();
}

key_InitDefault();
key_RegSubmitHandler(doSearch);
</script>


<%=uiBody%>>

<%@ include file="/framework/menu.jsp"%>
<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="Id" value="">
<input type=hidden name=sortOrder value="1">
<input type=hidden name=categoryName value="categoryName">
<input type=hidden name=warehouseCategoryId value="">

<!--查询条件保留区域-->
<input type=hidden name="s_WarehouseCode" value="<%=event.getWarehouseCode()%>"> <!--仓库编码-->
<input type=hidden name="s_SearchWarehouseCode" value="<%=event.getWarehouseCode()%>"> <!--仓库编码-->
<input type=hidden name="s_CategoryName" value="<%=event.getCategoryName()%>"> <!--分类名称-->
<input type=hidden name="s_Status" value="<%=event.getStatus()%>"> <!--是否有效-->
<%@ include file="/framework/list_head.jsp"%>

<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
	int key_tab = 1 ;
%>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            所属仓库：
        <%=SelectManager.viewWarehouseSelect(con,loginInfo.getLoginWarehouseCode(),"i_WarehouseCode",event.getWarehouseCode(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>    
            分类名称：
            <input type="text" class="texts" name="i_CategoryName" size="20" value="<%=event.viewCategoryName()%>" key_tab="<%=key_tab++%>">
        
            有&nbsp;效&nbsp;性： 
         <%=SelectManager.viewYesOrNoSelect("i_Status",event.viewStatus(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>       
    </tr>
	<%=uiSearchInputTR%>>
		<%=uiSearchInputTDHead%>>
			按&nbsp;排&nbsp;序：
		
			<select name="i_OrderField">
				<option value="" <%=(event.getOrderField().equals("1"))?"selected":""%>>设置排序字段</option>
				<option value="WAREHOUSE_NAME" <%=(event.getOrderField().equals("WAREHOUSE_NAME"))?"selected":""%>>仓库名称</option>
				<option value="CATEGORY_NAME" <%=(event.getOrderField().equals("CATEGORY_NAME"))?"selected":""%>>分类名称</option>		
				<option value="STATUS" <%=(event.getOrderField().equals("STATUS"))?"selected":""%>>是否有效</option>	
			</select>
			&nbsp;&nbsp;
			<input type="radio" name="i_OrderDesc" value="false" <%=(event.isOrderDesc()==false)?"checked":""%> >升序
			<input type="radio" name="i_OrderDesc" value="true"  <%=(event.isOrderDesc()==true)?"checked":""%>  >降序
			<input type="button" value="查询" class="buttons" onclick="doSearch();return false;">&nbsp;<input type="button" value="清空" class="buttons" onclick="doClearEvent();return false;">
		</td>
	</tr>

<%=uiSearchEnd%>

<!--列表标题-->
<%=UIManager.addListHeadTitle("仓库分类表列表")%>

<!--********************* Part6:List Area ***************-->

<%=uiListStart%>>

<%@ include file="/framework/list_foot.jsp"%>

<%
	int index = 1 ;
%>	
	<%=uiListHeadTR%>>
		<%=UIManager.addListHeadCheckBox() %>
		<%=UIManager.addListHead("所属仓库",index++)%>
        <%=UIManager.addListHead("分类名称",index++)%>
		<%=UIManager.addListHead("分类编码",index++)%>
        <%=UIManager.addListHead("分类关系",index++)%>
          <%=UIManager.addListHead("全称",index++)%>
        <%=UIManager.addListHead("有效性",index++)%> 
		<!--  <%=UIManager.addListHead("操作",-1)%>  -->
	<%=uiListHeadTREnd%>>
	
	<!--data-->
<%
	for(int i=0;i<list.size();i++)
	{
		WarehouseCategory obj = (WarehouseCategory)list.get(i);
		Warehouse warehouse =Warehouse.fetchByCode(con,obj.viewWarehouseCode(con));
%>
	<%=uiListDataTR[i%2]%> align=center>
    	<%=uiListDataTD%>>
    		<input type="checkbox" name="ids" value="<%=obj.getId()%>:<%=obj.viewWarehouseCode(con)%>">
    	</td>
        <%=uiListDataTD%>><%=obj.viewWarehouseName(con)%></td>
        <%=uiListDataTD%>><%=obj.viewCategoryName(con)%></td>
        <%=uiListDataTD%>><%=obj.viewCategoryCode(con)%></td>
        <%=uiListDataTD%>><%=obj.viewParentCategoryCode(con).equals(ConstDefine.WAREHOUSE_CATEGORY_TOP)?obj.viewCategoryCode(con):obj.viewParentCategoryCode(con)+"-"+obj.viewCategoryCode(con)%></td>
        <%=uiListDataTD%>><%=obj.viewParentCategoryCode(con).equals(ConstDefine.WAREHOUSE_CATEGORY_TOP)?obj.viewCategoryName(con):obj.viewParentCategoryName(con)+"-"+obj.viewCategoryName(con)%></td>
        <%=uiListDataTD%>><%=obj.viewStatus(con)%></td>
    	<!-- <%=uiListDataTD%>>
    		<a href="" onclick="bizViewWarehouseCategory('<%=obj.getId()%>');return false;">浏览</a>
    	</td>
    	 -->
  	</tr>
<%	
	}
%>  

<%@ include file="/framework/list_foot2.jsp"%>

<%=uiListEnd%>
<!--********************* Part7:Action Area ***************-->
<%=uiCommandStart%>>
	<%=uiCommandTR%>>
		<%=uiCommandTD%>>
		<input type=button value="   添加   " class="buttons" onclick="doToAdd();return false;">
		<input type=button value="   修改   " class="buttons" onclick="doToUpdate();return false;">	
        <input type=button value="  管理产品  " class="buttons" onclick="doProduct();return false;">
        <input type=button value="  未分类产品  " class="buttons" onclick="notSetCategory();return false;">
		</td>
	</tr>	
<%=uiCommandEnd%>
</form>
<%@ include file="/framework/foot.jsp"%>

<!--
	Author    :chengbiao.he
	FileName  :/system/base/WarehouseCategoryList.jsp
-->
